package com.example.provider.controller;

import com.example.common.entity.BaseUser;
import com.example.common.entity.Message;
import com.example.provider.service.LoginAndRegeistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class LoginAndRegistController {
    @Autowired
    private LoginAndRegeistService loginAndRegeistService;

    @ResponseBody
    @PostMapping("/regist")
    public Message regist (@RequestBody BaseUser u){
        return loginAndRegeistService.regist(u);
    }

    @ResponseBody
    @PostMapping("/login")
    public Message login(@RequestBody BaseUser u){
        return loginAndRegeistService.login(u);
    }
}
